import React, { useEffect } from "react";
import styles from "./index.module.less";
import Step from "./step";
import { connect } from "react-redux";
import { getPreviousAction } from "@redux/actions02";

const PreviousFonc = (props) => {
    const { list, getPreviousAction } = props;

    useEffect(() => {
        getPreviousAction && getPreviousAction();
    }, [getPreviousAction]);

    return (
        <div className={styles.previous_fonc}>
            {list &&
                list.map((item) => <Step key={item.key + "-"} item={item} />)}
        </div>
    );
};

export default connect(
    (state) => ({
        list: state.previousReducer,
    }),
    { getPreviousAction }
)(PreviousFonc);
